//
//  PKSMSUtilsTests.swift
//  Panku
//
//  Created by mac on 2017/4/27.
//  Copyright © 2017年 Monster. All rights reserved.
//

import XCTest

@testable import Panku

class PKSMSUtilsTests: XCTestCase {
    
    var smsUtils:PKSMSUtils!
    
    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
        let factory = PKSMSUtilsHelper.factory()
        smsUtils = factory()

    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    func testThatCanSendSMS() -> Void{
        
        //exception
        let asyncExpectation = expectation(description: "longRunningFunction")
        
        smsUtils.getVerificationCode(by: .sms, phoneNumber: "13883908997", zone: "86").startWithResult { (result) in
            
            print(result)
            
            //exception 释放线程
            asyncExpectation.fulfill()
        }
        
        //exception 阻塞线程
        self.waitForExpectations(timeout: 10) { (error) in
            if error != nil{
                XCTFail("timeout")
            }
        }
    }

}
